package com.ccjq.shosestore.core.dbmanager;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class DbConfigReader {
    private Properties prop;

    public DbConfigReader() {
        this.read();
    }

    /*读取配置文件的方法*/
    private void read() {
        //A.
        prop = new Properties();
        //B.1转换为字节输入流
        InputStream is = DbConfigReader.class.getResourceAsStream("/dbConfig.properties");
        //B.2
        try {
            prop.load(is);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    /*根据键取值
     *@param key
     * @return/
     */
    public String getValue(String key) {
        return prop.getProperty(key);
    }

}
